var program = require('commander');
var webdriver = require('selenium-webdriver'),
    By = webdriver.By,
    until = webdriver.until;
var fs = require("fs");

program
    .version('1.0.0')
    .option('-k, --keyword [keyword]', '抓取关键词', '景甜')
    .option('-t, --time [time]', '抓取张数', 100)
    .option('-b, --browser [browser]', '浏览器核心', 'chrome')
    .parse(process.argv);

var keyword = program.keyword;
var maxId = program.time;
var browser = program.browser;
var currentId = 0;
var imgUrlList = [];
var driver = new webdriver.Builder()
    .forBrowser(browser)
    .build();
a = driver.get("http://pic23.nipic.com/20120830/7103350_081925405000_2.jpg")
fs.writeFile('./message.txt', a,function(err){
    if(err) console.log('写文件操作失败');
    else console.log('写文件操作成功');
});

